//
//  PopulationItemModel.m
//  Utils
//
//  Created by enghou on 2018/4/20.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "PopulationItemModel.h"
#import "NetPath.h"
@implementation PopulationItemModel

-(instancetype)initWithSource:(NSDictionary *)source{
    self = [super initWithSource:source];
    if (self) {
        self.ids = [self contentForKey:@"id" withSource:source];
        self.head_image = [self contentForKey:@"imgUrl" withSource:source];
        self.head_image = [NSString stringWithFormat:@"%@/%@",ServerPath,self.head_image];
        NSString *name = [self contentForKey:@"name" withSource:source];
        NSString *idCardNo = [self contentForKey:@"idCardNo" withSource:source];;
        self.name = [NSString stringWithFormat:@"%@(%@)",name,idCardNo];
        NSString *age = [self intContentForKey:@"age" withSource:source];
        NSDictionary *gender = [source objectForKey:@"gender"];
        NSString *male = [self contentForKey:@"displayName" withSource:gender];
        self.desc = [NSString stringWithFormat:@"%@ %@岁",male,age];
        self.address = [self contentForKey:@"currentAddress" withSource:source];
        if (self.address.length == 0) {
            self.height = 60;
        }else{
            CGSize size = [self.address caculateSizeWithFont:[UIFont systemFontOfSize:14] MaxSize:CGSizeMake(ScreenWidth - 170, 34)];
            self.height = 60 + size.height - 17;
        }
    }
    return self;
}

@end
